package k_singleton.a_design_pattern.e_hungry_b;

/**
 * Created by wug on 2016/7/29 0029.
 * 饿汉式变种
 */
public class Singleton {
    private static Singleton instance = null;

    //表面上看起来差别挺大，其实更第三种方式差不多，都是在类初始化即实例化instance。
    static {
        instance = new Singleton();
    }

    private Singleton (){}

    public static Singleton getInstance() {
        return instance;
    }
}
